﻿using System;
using Microsoft.Xna.Framework.Graphics;

namespace Phoenix.Xna.Framework.Components.Terrain
{
    public struct TerrainDataBuffer : IDisposableEx
    {
        public VertexBuffer VertexBuffer { get; set; }
        public IndexBuffer IndexBuffer { get; set; }
        public int NumberOfVertices { get; set; }
        public int NumberOfIndices { get; set; }

        private void Dispose(bool disposing)
        {
            if (!IsDisposed && disposing)
            {
                VertexBuffer.Dispose();
                IndexBuffer.Dispose();
                IsDisposed = true;
            }
        }

        #region IDisposableEx Members

        public bool IsDisposed { get; private set; }

        #endregion

        #region IDisposable Members

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        #endregion
    }

}
